<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  
  <script type="text/javascript" src="./lib/jquery.js"></script>
  <script type="text/javascript">
    // 无法通过返回值得到异步结果，必须通过回调函数才可以
    function getBooks (fn) {
      $.get('http://www.liulongbin.top:3006/api/getbooks', function (res) {
        var books = res.data
        fn(books)
      })
    }
    getBooks(function (data) {
      console.log(data)
    })



  </script>
</body>
</html>